package cn.itcast.firstapp.servlet;

import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Author: 朱新舜
 * @Date: 2020-05-30 16:49:43
 */
@WebServlet("/helloWorldServlet")
public class HelloWorldServlet extends GenericServlet {

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        // 得到输出流PrinterWriter对象，Servlet使用输出流来产生响应
        PrintWriter out = servletResponse.getWriter();
        // 使用输出流对象向客户端发送字符数据
        out.println("Hello World");

    }
}
